package com.ssy.lingxi.member.merchant.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Set;

/**
 * 会员管理流程规则配置
 * @author 万宁
 * @version 2.0.0
 * @date 2021-05-14
 */
@Entity
@Table(schema = "public", name = "ms_mc_member_process_rule", indexes = {@Index(name = "ms_mc_member_process_rule_member_id_idx", columnList = "memberId"), @Index(name = "ms_mc_member_process_rule_role_id_idx", columnList = "roleId"), @Index(name = "ms_mc_member_process_rule_sub_role_id_idx", columnList = "sub_role_id"), @Index(name = "ms_mc_member_process_rule_status_idx", columnList = "status")})
public class MemberProcessRuleDO implements Serializable {
    private static final long serialVersionUID = -4029986856707868994L;

    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE,generator="member_process_rule_seq")
    @SequenceGenerator(sequenceName="ms_mc_member_process_rule_seq", name="member_process_rule_seq", allocationSize = 1)
    private Long id;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime createTime;

    /**
     * 会员Id
     */
    @Column
    private Long memberId;

    /**
     * 会员角色Id
     */
    @Column
    private Long roleId;

    /**
     * 多对一单向关联下级会员角色
     */
    @ManyToOne(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinColumn(name = "sub_role_id", referencedColumnName = "id")
    private RoleDO subRole;

    /**
     * 流程规则名称
     */
    @Column(columnDefinition = "varchar(50)")
    private String ruleName;

    /**
     * 入库流程的Id（基础流程Id）
     */
    @Column
    private Long baseDepositoryProcessId;

    /**
     * 流程对应的工作流的Key
     */
    @Column(columnDefinition = "varchar(50)")
    private String baseDepositoryProcessKey;

    /**
     * 入库流程是否空流程（即：无需入库审核）
     */
    @Column
    private Boolean emptyDepositoryProcess;

    /**
     * 资料变更流程Id（基础流程Id）
     */
    @Column
    private Long baseDetailChangeProcessId;

    /**
     * 资料变更流程对应的工作流的Key
     */
    @Column(columnDefinition = "varchar(50)")
    private String baseDetailChangeProcessKey;

    /**
     * 资料变更流程是否空流程，（即：无需资料变更审核）
     */
    @Column
    private Boolean emptyDetailChangeProcess;

    /**
     * 多对多单向关联会员注册资料（入库资料）
     */
    @ManyToMany(cascade = CascadeType.DETACH, fetch = FetchType.LAZY)
    @JoinTable(name="ms_mc_member_process_rule_member_config_relation", joinColumns={ @JoinColumn(name="member_process_rule_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn(name="member_config_id", referencedColumnName="id")})
    private Set<MemberConfigDO> configs;

    /**
     * 状态，0-无效，1-有效
     */
    @Column
    private Integer status;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public RoleDO getSubRole() {
        return subRole;
    }

    public void setSubRole(RoleDO subRole) {
        this.subRole = subRole;
    }

    public String getRuleName() {
        return ruleName;
    }

    public void setRuleName(String ruleName) {
        this.ruleName = ruleName;
    }

    public Long getBaseDepositoryProcessId() {
        return baseDepositoryProcessId;
    }

    public void setBaseDepositoryProcessId(Long baseDepositoryProcessId) {
        this.baseDepositoryProcessId = baseDepositoryProcessId;
    }

    public String getBaseDepositoryProcessKey() {
        return baseDepositoryProcessKey;
    }

    public void setBaseDepositoryProcessKey(String baseDepositoryProcessKey) {
        this.baseDepositoryProcessKey = baseDepositoryProcessKey;
    }

    public Boolean getEmptyDepositoryProcess() {
        return emptyDepositoryProcess;
    }

    public void setEmptyDepositoryProcess(Boolean emptyDepositoryProcess) {
        this.emptyDepositoryProcess = emptyDepositoryProcess;
    }

    public Long getBaseDetailChangeProcessId() {
        return baseDetailChangeProcessId;
    }

    public void setBaseDetailChangeProcessId(Long baseDetailChangeProcessId) {
        this.baseDetailChangeProcessId = baseDetailChangeProcessId;
    }

    public String getBaseDetailChangeProcessKey() {
        return baseDetailChangeProcessKey;
    }

    public void setBaseDetailChangeProcessKey(String baseDetailChangeProcessKey) {
        this.baseDetailChangeProcessKey = baseDetailChangeProcessKey;
    }

    public Boolean getEmptyDetailChangeProcess() {
        return emptyDetailChangeProcess;
    }

    public void setEmptyDetailChangeProcess(Boolean emptyDetailChangeProcess) {
        this.emptyDetailChangeProcess = emptyDetailChangeProcess;
    }

    public Set<MemberConfigDO> getConfigs() {
        return configs;
    }

    public void setConfigs(Set<MemberConfigDO> configs) {
        this.configs = configs;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
}
